<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	    <meta name="description" content="">
	    <meta name="author" content="">
		
		<title>自习室预约</title>
		 <link rel="stylesheet" href="css/amazeui.min.css">
		 
		 <link href="css/bootstrap.css" rel="stylesheet">
		 
		 <meta name="renderer" content="webkit">
		 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="layui/css/layui.css"  media="all">
		
	    <!-- Bootstrap core CSS -->
	    <link href="dhcss/bootstrap.min.css" rel="stylesheet">
	    <!-- Additional CSS Files -->
	    <link rel="stylesheet" href="dhcss/fontawesome.css">
	    <link rel="stylesheet" href="dhcss/templatemo-style.css">
	    <link rel="stylesheet" href="dhcss/owl.css">
		<!-- 设置选择框的位置 -->
		<style type="text/css">
			.layui-form{
				width: 30%;
				margin-left: 200px;
				margin-top: 50px;
			}
			.zuowei{
				margin-left: 600px;
				margin-top: 0px;
				background-color: #565656;
			}
			.myimg{
				width: 50px;
				height: 50px;
			}
			.mylabel{
				font-size: 20px;
			}
			
			
		</style>
		
		<script src="${pageContext.request.contextPath}/js/jquery-2.0.3.js"></script>
		
		
	</head>
	<body>
	
       
 <div id="wrapper"> 
<div id="main">
   <div class="inner" style="">
   		
   		 <!-- Header -->
         <header id="header">
           <div class="logo">
           <div class="layui-form">
			    <select name="city" lay-verify="" lay-filter="test" id="select">
			        <option value="01">请选择一个教室</option>
			        <option value="01">自习室101</option>
			        <option value="102">自习室102</option>
			        <option value="103">自习室103</option>
			    </select>
			   
			</div>
              <a class="zuowei"  href="http://demo.qfpffmp.cn/cssthemes6/dgmg_38_ramayana/index.html">座位信息</a>
           </div>
         </header>
   		
   		<!-- 主体 -->
		<section class="tables">
			
	       <label class="mylabel" id="Rno"></label>&nbsp;&nbsp;&nbsp;&nbsp;
	       <label class="mylabel" id="Rposition"></label>&nbsp;&nbsp;&nbsp;&nbsp;
	       <label class="mylabel" id="Rfreeseat"></label>&nbsp;&nbsp;&nbsp;&nbsp;
	       <br>
	       <label></label>
	       <label class="mylabel" id="Rstime"></label>——
	       <label class="mylabel" id="Retime"></label>
       
			<!-- 得到这个教室的所有座位信息 -->
	      <ul class="am-avg-sm-2 am-avg-md-4 am-avg-lg-6 am-margin gallery-list">
	      	
	      	<c:if test="${list==null}">
				<c:redirect url="SeatServlet?op=all"></c:redirect>
			</c:if>
			
			<c:if test="${list!=null }">
				<c:forEach items="${list }" var="seat">
					<li>
			          <a class="seatImg" href="#">
			            <img class="myimg" src="images/zw01${seat.estatus }.png" alt="">
			            <div class="gallery-title">${seat.eseatno }</div>
			          </a>
			        </li>
				</c:forEach>
			</c:if>
	        
	      </ul>
      		<!-- 得到这个教室的所有座位信息    结束 -->
		</section>
        
	</div>
</div>
<<<<<<< HEAD
<%@include file="qdaohang.jsp" %>

=======
<jsp:include page="daohang.jsp"></jsp:include>
>>>>>>> branch 'master' of https://gitee.com/wzx823570766/BeiJing_Project_Level_Two.git
</div>     		

	<!-- ssss -->
         <!-- Scripts -->
  <!-- Bootstrap core JavaScript -->

    <script src="dhjs/browser.min.js.下载"></script>
    <script src="dhjs/breakpoints.min.js.下载"></script>
    <script src="dhjs/transition.js.下载"></script>
    <script src="dhjs/owl-carousel.js.下载"></script>
    <script src="dhjs/custom.js.下载"></script>
       
		<!--分页操作 2- 引入layui.js文件 -->
		<script src="layui/layui.js" charset="utf-8"></script>
		
		<script>
		
		$(function() {
			var rno = "${rno}";
			var usrid =  $.session.get('userid');
			console.log(usrid);
			$(".select").val(rno);
			$.ajax({
	        	 url:"SeatServlet",
	             type: "post",
	             data: {
	            	 rno:rno,
	            	 op:"getByRno"
	             },
	             dataType: "json",
	             success: function(res){
	            	 console.log("输出一下res");
	            	 console.log(res);
	            	 $("#Rno").html("教室号："+res.Rno);
	            	 $("#Rposition").html("教室位置："+res.Rposition);
	            	 $("#Rfreeseat").html("空余座位："+res.Rfreeseat);
	            	 var rstime = res.Rstime;
	            	 rstime = rstime.substring(0,5);
	            	 $("#Retime").html(res.Retime);
	            	 $("#Rstime").html("开放时间为："+rstime);
                }
	         });
		});
		//Demo
		layui.use(['form'], function () {
		    var form = layui.form;
		    form.on('select(test)', function (data) {
			    //TODO执行自己的代码
				var rno = $("select option:selected").val();
			    console.log("rno:"+rno)
				$.ajax({
		        	 url:"SeatServlet",
		             type: "post",
		             data: {
		            	 rno:rno,
		            	 op:"getByRno"
		             },
		             dataType: "json",
		             success: function(res){
                     }
		         },location.href="SeatServlet?op=all&rno="+rno);
			});
		});
		
		 //点击座位-->弹窗
		  $(".seatImg").click(function() {
			  var eseatno = $(this).text();
			  console.log(eseatno);
			  layer.open({
				  type: 2,
				  skin: 'layui-layer-demo', //样式类名
				  closeBtn: 1, //不显示关闭按钮
				  anim: 2,
				  shadeClose: true, //开启遮罩关闭
				  content: 'SeatInline.jsp?eseatno='+eseatno,
				  area: ['500px', '600px']
				});
		});
		
		</script>
		
	</body>
</html>
